#include <stdio.h>
#include <string.h>
#include "ObjectDrawingFunctions.h"
#include "SimpleVectorMatrix.h"
#include <GL/glut.h>
#include <GL/gl.h>

void displayObjectOnMarker(float* pose_matrix, ObjectDrawFunction object_function)
{
	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();

	float tmp_pose_matrix[16];
	memcpy(tmp_pose_matrix, pose_matrix, 16*sizeof(float));

	transposeMatrix16(tmp_pose_matrix);
	glLoadMatrixf(tmp_pose_matrix);

	glRotatef( -90, 1, 0, 0 );
	glScalef(0.04, 0.04, 0.04);

	object_function();
}

void drawRedNose()
{
	glPushMatrix();
	glTranslatef(0, -0.5, -1.8);
	glColor4f( 1.0, 0.0, 0.0, 1.0 );
	glutSolidSphere(0.5, 50, 50);
}

void drawSnowMan(float radius1 = 0.5f, float radius2 = 0.35f, float radius3 = 0.25f)
{
	glPushMatrix();

	glColor4f(1.0, 1.0, 1.0, 1.0);
	// Draw the first sphere
	glTranslatef(0, radius1, 0);
	glutSolidSphere(radius1, 20, 20);

	// Draw the second sphere
	glTranslatef(0, radius1 + radius2 - 0.15f, 0);
	glutSolidSphere(radius2, 40, 40);

	// Draw the third sphere
	glTranslatef(0, radius2 + radius3 - 0.1f, 0);
	glutSolidSphere(radius3, 40, 40);

	// Draw the nose
	glColor4f(1.0, 0.3, 0, 1);
	glutSolidCone(0.1, 0.5, 20, 20);

	// Draw the eyes
	glPushMatrix();
	
	glColor4f(0.0, 0.0, 0.0, 1.0);

	glTranslatef(radius3 * 0.4, radius3 * 0.4, radius3 - 0.05f);
	glutSolidSphere(0.04, 10, 10);

	glTranslatef((-2) * radius3 * 0.4, 0, 0);
	glutSolidSphere(0.04, 10, 10);
}

void drawSimpleSnowman()
{
	drawSnowMan();
}

void drawFatSnowman()
{
	drawSnowMan(0.7f, 0.5f, 0.25f);
}


